'\" -*- coding: UTF-8 -*-
.\" Copyright (C) 1998-2004 Miquel van Smoorenburg.
.\"
.\" This program is free software; you can redistribute it and/or modify
.\" it under the terms of the GNU General Public License as published by
.\" the Free Software Foundation; either version 2 of the License, or
.\" (at your option) any later version.
.\"
.\" This program is distributed in the hope that it will be useful,
.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
.\" GNU General Public License for more details.
.\"
.\" You should have received a copy of the GNU General Public License
.\" along with this program; if not, write to the Free Software
.\" Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
.\"
.\"{{{}}}
.\"{{{  Title
.TH LAST, LASTB 1 "Jul 31, 2004" "sysvinit " "User Commands"
.\"}}}
.\"{{{  Name
.SH NAME
last, lastb \- show listing of last logged in users
.\"}}}
.\"{{{  Synopsis
.SH SYNOPSIS
.B last
.RB [ \-R ]
.RB [ \-\fInum\fP ]
[\-\fBn\fP \fInum\/\fP]
.RB [ \-adFiowx ]
[\-\fBf\fP \fIfile\/\fP]
[\-\fBt\fP \fIYYYYMMDDHHMMSS\/\fP]
.RI [ name... ]
.RI [ tty... ]
.br
.B lastb
.RB [ \-R ]
.RB [ \-\fInum\fP ]
[\-\fBn\fP \fInum\/\fP]
[\-\fBf\fP \fIfile\/\fP]
.RB [ \-adFiowx ]
.RI [ name... ]
.RI [ tty... ]
.\"}}}
.\"{{{  Description
.SH DESCRIPTION
.B Last
searches back through the file \fB/var/log/wtmp\fP (or the file
designated by the \fB\-f\fP flag) and displays a list of all
users logged in (and out) since that file was created.  Names of users
and tty's can be given, in which case \fBlast\fP will show only those entries
matching the arguments.  Names of ttys can be abbreviated, thus \fBlast
0\fP is the same as \fBlast tty0\fP.  
.PP
When \fBlast\fP catches a \fBSIGINT\fP signal (generated by the interrupt key,
usually control-C) or a \fBSIGQUIT\fP signal (generated by the quit key, 
usually control-\e), \fBlast\fP will show how far it has searched through the 
file; in the case of the \fBSIGINT\fP signal \fBlast\fP will then terminate.
.PP
The pseudo user \fBreboot\fP logs in each time the system is rebooted.
Thus \fBlast reboot\fP will show a log of all reboots since the log file
was created.
.PP
\fBlastb\fP is the same as \fBlast\fP, except that by default it shows a log
of the file \fB/var/log/btmp\fP, which contains all the bad login attempts.
.\"}}}
.\"{{{  Options
.SH OPTIONS
.IP "\fB\-f\fP \fIfile\fP"
Tells \fBlast\fP to use a specific file instead of \fI/var/log/wtmp\fP.
.IP \fB\-\fP\fInum\fP
This is a count telling \fBlast\fP how many lines to show.
.IP "\fB\-n\fP \fInum\fP"
The same.
.IP "\fB\-t\fP \fIYYYYMMDDHHMMSS\fP"
Display the state of logins as of the specified time.  This is
useful, e.g., to determine easily who was logged in at a particular
time -- specify that time with \fB\-t\fP and look for "still logged
in".
.IP \fB\-R\fP
Suppresses the display of the hostname field.
.IP \fB\-a\fP
Display the hostname in the last column. Useful in combination
with the next flag.
.IP \fB\-d\fP
For non-local logins, Linux stores not only the host name of the remote
host but its IP number as well. This option translates the IP number
back into a hostname.
.IP \fB\-F\fP
Print full login and logout times and dates.
.IP \fB\-i\fP
This option is like \fB-d\fP in that it displays the IP number of the remote
host, but it displays the IP number in numbers-and-dots notation.
.IP \fB\-l\fP
This option allows the display of usernames longer than 8 characters.
This may mess up formatting in some programs and make the output wider than
the standard 80 characters.
.IP \fB\-o\fP
Read an old-type wtmp file (written by linux-libc5 applications).
.IP \fB\-w\fP
Display full user and domain names in the output.
.IP \fB\-x\fP
Display the system shutdown entries and run level changes.
.\"}}}
.SH NOTES
The files \fIwtmp\fP and \fIbtmp\fP might not be found. The system only
logs information in these files if they are present. This is a local
configuration issue. If you want the files to be used, they can be
created with a simple \fBtouch\fP(1) command (for example, 
\fBtouch /var/log/wtmp\fP).
.\"{{{  Files
.SH FILES
/var/log/wtmp
.br
/var/log/btmp
.\"}}}
.\"{{{  Author
.SH AUTHOR
.MT miquels@\:cistron\:.nl
Miquel van Smoorenburg
.ME
.\"}}}
.\"{{{  See also
.SH "SEE ALSO"
.BR shutdown (8),
.BR login (1),
.BR init (8)
.\"}}}
